package org.example.Command.Case2;

import java.util.ArrayList;
import java.util.List;

/**
 * 命令调用者 Invoker
 * 接收多个命令并执行
 */
public class Broker {
    private List<Order> orderList = new ArrayList<>();

    public void takeOrder(Order order){
      orderList.add(order);
    }

    public void placeOrders(){
        for (Order order : orderList) {
            order.execute();
        }
        orderList.clear();
    }
}
